<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">

<html>
<head>
  <link href="doxygen.css" rel="stylesheet" type="text/css">

  <title>Unit Tests</title>
</head>

<body>
  <div class='header'>
    <div class='headertitle'>
      Unit Tests
    </div>
  </div>

  <div class='contents'>
    <p>QuickFIX comes with a comprehensive suite of automated unit
    tests written. These tests are run by a framework called <a href=
    "https://github.com/catchorg/Catch2">Catch2</a>.
    Catch2 allows developers to test C++ code by writing code
    that calls functions on objects and asserting correct behavior.
    These test verifies not only that the code works correctly, but
    also that it works the same on all platforms.</p>

    <p>This sample shows the setup and execution of the test that
    verifies the Parser object can correctly extract messages from
    a stream.</p>
    <pre class='fragment'>
struct readFixMessageFixture
{
  readFixMessageFixture()
  {
    fixMsg1 = "8=FIX.4.2\0019=12\00135=A\001108=30\00110=31\001";
    fixMsg2 = "8=FIX.4.2\0019=17\00135=4\00136=88\001123=Y\00110=34\001";
    fixMsg3 = "8=FIX.4.2\0019=19\00135=A\001108=30\0019710=8\00110=31\001";

    object.addToStream( fixMsg1 + fixMsg2 + fixMsg3 );
  }

  std::string fixMsg1;
  std::string fixMsg2;
  std::string fixMsg3;
  Parser object;
};

TEST_FIXTURE(readFixMessageFixture, readFixMessage)
{
  std::string readFixMsg1;
  CHECK( object.readFixMessage( readFixMsg1 ) );
  CHECK_EQUAL( fixMsg1, readFixMsg1 );

  std::string readFixMsg2;
  CHECK( object.readFixMessage( readFixMsg2 ) );
  CHECK_EQUAL( fixMsg2, readFixMsg2 );

  std::string readFixMsg3;
  CHECK( object.readFixMessage( readFixMsg3 ) );
  CHECK_EQUAL( fixMsg3, readFixMsg3 );
}
</pre>
  </div>
</body>
</html>
